<?

	$cover = $item->getCover();
	if($cover){
		echo CHtml::image(Yii::app()->request->hostInfo.'/images/'.$cover,$item->title,array(
			'height' => '50',
		));
	}
	echo '<a href="'.Yii::app()->createurl('item/index', array('id' => $item->id)).'">'.$item->title.'</a>'.'('.$item->price.')<strike>'.$item->old_price.'</strike>';
	echo " Рейтинг:".(int)$item->rating_yes.'/'.(int)$item->rating_yes;
	echo '<br/>В корзине: '.$item->countInCart().' шт.';
	if(!Yii::app()->shoppingCart->contains($item->id)){
		echo CHtml::form(Yii::app()->request->hostInfo.'/cart/update','POST');
		echo CHtml::hiddenField('id', base64_encode($item->id));
		echo CHtml::hiddenField('action', base64_encode('add'));
		echo CHtml::hiddenField('fullPath', base64_encode(yiistoAbsolutePath()));
		echo CHtml::ajaxSubmitButton ("Добавить в корзину",CController::createUrl('cart/update'),
			array(
                    'success' => 'function(data){
                        $("#cart").load("'.Yii::app()->request->hostInfo.'/cart/getWidget",{fullPath: "'.base64_encode(yiistoAbsolutePath()).'"});
                        $(".item'.$item->id.'").load("'.Yii::app()->request->hostInfo.'/item/single/id/'.$item->id.'");
                    }',
			),
			array(
				'id' => 'add_'.$item->id,
			)
		);
		echo CHtml::endForm();
	}else{
		echo CHtml::form(Yii::app()->request->hostInfo.'/cart/update','POST');
		echo CHtml::hiddenField('id', base64_encode($item->id));
		echo CHtml::hiddenField('action', base64_encode('add'));
		echo CHtml::hiddenField('fullPath', base64_encode(yiistoAbsolutePath()));
		echo CHtml::ajaxSubmitButton ("+",CController::createUrl('cart/update'),
			array(
                    'success' => 'function(data){
                        $("#cart").load("'.Yii::app()->request->hostInfo.'/cart/getWidget");
                        $(".item'.$item->id.'").load("'.Yii::app()->request->hostInfo.'/item/single/id/'.$item->id.'");
                    }',
			),
			array(
				'id' => 'add_'.$item->id,
			)
		);
		echo CHtml::endForm();
		echo CHtml::form(Yii::app()->request->hostInfo.'/cart/update','POST');
		echo CHtml::hiddenField('id', base64_encode($item->id));
		echo CHtml::hiddenField('action', base64_encode('decrement'));
		echo CHtml::hiddenField('fullPath', base64_encode(yiistoAbsolutePath()));
		echo CHtml::ajaxSubmitButton ("-",CController::createUrl('cart/update'),
			array(
                    'success' => 'function(data){
                        $("#cart").load("'.Yii::app()->request->hostInfo.'/cart/getWidget");
                        $(".item'.$item->id.'").load("'.Yii::app()->request->hostInfo.'/item/single/id/'.$item->id.'");
                    }',
			),
			array(
				'id' => 'add_'.$item->id,
			)
		);
		echo CHtml::endForm();
		echo CHtml::form(Yii::app()->request->hostInfo.'/cart/update','POST');
		echo CHtml::hiddenField('id', base64_encode($item->id));
		echo CHtml::hiddenField('action', base64_encode('remove'));
		echo CHtml::hiddenField('fullPath', base64_encode(yiistoAbsolutePath()));
		echo CHtml::ajaxSubmitButton ("Удалить из корзины",CController::createUrl('cart/update'),
			array(
                    'success' => 'function(data){
                        $("#cart").load("'.Yii::app()->request->hostInfo.'/cart/getWidget");
                        $(".item'.$item->id.'").load("'.Yii::app()->request->hostInfo.'/item/single/id/'.$item->id.'");
                    }',
			),
			array(
				'id' => 'add_'.$item->id,
			)
		);
		echo CHtml::endForm();
	}
?>